package com.toubutu.audio.admin.dto;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.toubutu.audio.common.QueryBaseDto;
import com.toubutu.audio.entity.Video;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;

/**
 * @author 戒躁
 * @date 2024/1/10
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class AdminVideoQueryDto extends QueryBaseDto<Video> {
    private String videoCode;
    private String videoName;
    @Override
    public LambdaQueryWrapper<Video> getWrapper() {
        LambdaQueryWrapper<Video> wrapper = new LambdaQueryWrapper<>();
        if (StringUtils.isNotBlank(videoCode)){
            wrapper.eq(Video::getVideoCode,videoCode);
        }
        if (StringUtils.isNotBlank(videoName)){
            wrapper.like(Video::getVideoName,videoName);
        }
        return wrapper;
    }
}
